package com.loyal.camerax.utils

import android.app.Activity
import android.content.SharedPreferences
import androidx.preference.PreferenceManager

object PreferenceHelper {
    const val KEY_RESTART_ACTION = "action_restart"
    const val KEY_CHANGED_ACTION = "action_value_changed"
    const val MUTABLE_ORIENTATION = "mutable_orientation"

    fun Activity.get(key: String, defValue: String? = null): String? {
        val sharedPreferences =
            PreferenceManager.getDefaultSharedPreferences(this)
        return sharedPreferences.getString(key, defValue)
    }

    fun SharedPreferences.get(key: String, defValue: String? = null): String? {
        return getString(key, defValue)
    }
}


